# 列出指定目录下的所有py文件
import os

path = os.getcwd()  # 获取当前目录
lst = os.listdir(path)  # 获取当前目录下的文件和文件夹

for filename in lst:
    if filename.endswith('.py'):
        print(filename)
print('===================')

# 将当前目录下的所有文件（包括子目录）都列出来
path = os.getcwd()
lst_files = os.walk(path)
for dirpath, dirname, filename in lst_files:
    # print(dirpath)
    # print(dirname)
    # print(filename)
    for dir in dirname:
        print(os.path.join(dirpath,dir))

    for file in filename:
        print(os.path.join(dirpath,file))
    print('=====================')
